import passwordMod from './password.js'
export default {
	"username": {
		"rules": [{
				required: true,
				errorMessage: '请输入登录账号',
			},
			{
				validateFunction: function(rule, value, data, callback) {
					if (!/^\w{6,16}$/.test(value)) {
						callback('长度6~16只能包含字母、数字和下划线')
					};
					if(/[\u4E00-\u9FA5\uF900-\uFA2D]{1,}/.test(value)){
						callback('登录账号不能包含中文')
					}
					return true
				}
			}
		],
		"label": "登录账号"
	},
	"nickName": {
		"rules": [{
				required: true,
				errorMessage: '请输入昵称',
			},{
				minLength: 2,
				maxLength: 20,
				errorMessage: '昵称长度在 {minLength} 到 {maxLength} 个字符',
			}
		],
		"label": "昵称"
	},
	"email": {
		"rules": [{
				required: true,
				errorMessage: '请输入邮箱',
			},
			{
				validateFunction: function(rule, value, data, callback) {
					const reg = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
					if (!reg.test(value)) {
					  callback('请输入正确的Email')
					}
					return true
				}
			}
		],
		"label": "邮箱"
	},
	"phonenumber": {
		"rules": [{
				required: true,
				errorMessage: '请输入手机号码',
			},
			{
				validateFunction: function(rule, value, data, callback) {
					const reg = /^1\d{10}$/
					if (!reg.test(value)) {
					  callback('请输入正确的11位手机号码')
					}
					return true
				}
			}
		],
		"label": "手机号码"
	},
	...passwordMod.getPwdRules()
}
